package cn.lhl.dao.impl;

import cn.lhl.dao.IStuckDao;
import cn.lhl.entity.Stuck;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/4/4/004.
 */
public class StuckDaoImpl implements IStuckDao {
    private SessionFactory sessionFactory;
    @Transactional
    public int addStuck(Stuck stuck) {
        Session session = sessionFactory.getCurrentSession();
        Serializable save = session.save(stuck);
        return (Integer)save;
    }

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
}
